package controller

import (
	"context"
	"github.com/gogf/gf/v2/frame/g"
	"goframe/apiv1"
)

var (
	Hello = cHello{}
)

type cHello struct{}

func (h *cHello) Hello(ctx context.Context, req *apiv1.HelloReq) (res *apiv1.HelloRes, err error) {
	v, err2 :=g.Redis().Do(ctx,"BRPOP","list",0)
	if err2 != nil {
		g.Log().Info(ctx,"未弹出元素")
		g.RequestFromCtx(ctx).Response.Writeln("当前没有元素")
	}else {
		g.Log().Info(ctx,v.String())
		res = &apiv1.HelloRes{Info:v.Array()[1].(string)}
	}
	return
}
